package com.itlaobing.test1;

import java.io.File;

public class FileListTest {

	public static void main(String[] args) {
		File file=new File("D:\\workT2082");
		listFile(file,0);
	}

	private static void listFile(File file,int height) {
		StringBuffer sb=new StringBuffer();
		for (int i = 0; i < height; i++) {
			sb.append("--");
		}
		System.out.println(sb.append(file.getName()));
		if(file.isDirectory()) {
			File[] childs = file.listFiles();
			for (File file2 : childs) {
				listFile(file2,height+1);
			}
		}
	}
}
